
package com.eworking.eim.message.body;

import android.os.Parcel;
import android.os.Parcelable;

public class CmdMessageBody extends MessageBody {
    
    /** 指令 */
    public String action;
    
    /** 参数 */
    public String[] params;
    
    public static final Parcelable.Creator<CmdMessageBody> CREATOR = new Parcelable.Creator<CmdMessageBody>() {
        
        public CmdMessageBody createFromParcel(Parcel parcel) {
            return new CmdMessageBody(parcel, null);
        };
        
        public CmdMessageBody[] newArray(int size) {
            return new CmdMessageBody[size];
        };
    };
    
    public CmdMessageBody(String action, String[] params) {
        this.action = action;
        this.params = params;
    }
    
    public String toString() {
        return "cmd:\"" + this.action + "\"";
    }
    
    public int describeContents() {
        return 0;
    }
    
    public void writeToParcel(Parcel parcel, int paramInt) {
        parcel.writeString(this.action);
        parcel.writeStringArray(this.params);
    }
    
    private CmdMessageBody(Parcel parcel, String[] params) {
        this.action = parcel.readString();
        this.params = (String[]) parcel.readArray(null);
    }
}
